Skip to content

docs: make wait_for_callback async - #3466

Closed
saquibsaifee wants to merge 3 commits into
modelcontextprotocol:mainfrom
saquibsaifee:jules-14512903098408185376-17c376c5
Closed

docs: make wait_for_callback async#3466
saquibsaifee wants to merge 3 commits into
modelcontextprotocol:mainfrom
saquibsaifee:jules-14512903098408185376-17c376c5

Conversation

@saquibsaifee

Copy link
Copy Markdown

While this is an example client, keeping its event loop responsive is important for correctness and for demonstrating best practices when using asyncio.

What: Modified CallbackServer.wait_for_callback in mcp_simple_auth_client/main.py to be an async function, utilizing await asyncio.sleep(0.1) instead of the blocking time.sleep(0.1). The call in callback_handler was also updated to await this execution.
Why: The previous implementation used the blocking time.sleep, which stalled the asyncio event loop and delayed other background coroutines running concurrently, making the application unresponsive during the waiting period.
Measured Improvement:
Baseline: Max event loop delay was measured at ~0.910s when simulating a 1s wait.
After fix: Event loop remained fully responsive (Max delay 0.000s) during the wait period.
What: Modified CallbackServer.wait_for_callback in mcp_simple_auth_client/main.py to be an async function, utilizing await asyncio.sleep(0.1) instead of the blocking time.sleep(0.1). The call in callback_handler was also updated to await this execution.
Why: The previous implementation used the blocking time.sleep, which stalled the asyncio event loop and delayed other background coroutines running concurrently, making the application unresponsive during the waiting period.
Measured Improvement:
Baseline: Max event loop delay was measured at ~0.910s when simulating a 1s wait.
After fix: Event loop remained fully responsive (Max delay 0.000s) during the wait period.
What: Modified CallbackServer.wait_for_callback in mcp_simple_auth_client/main.py to be an async function, utilizing await asyncio.sleep(0.1) instead of the blocking time.sleep(0.1). The call in callback_handler was also updated to await this execution.
Why: The previous implementation used the blocking time.sleep, which stalled the asyncio event loop and delayed other background coroutines running concurrently, making the application unresponsive during the waiting period.
Measured Improvement:
Baseline: Max event loop delay was measured at ~0.910s when simulating a 1s wait.
After fix: Event loop remained fully responsive (Max delay 0.000s) during the wait period.
@github-actions github-actions Bot added the missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md) label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and this PR doesn't link an open issue yet.

  • If you're already assigned to an issue for this, add Fixes #<n> to the description and the PR will reopen on its own.
  • If there's no issue yet, please open one instead: what you ran into, why it matters for your use case, and a minimal reproduction. That context is super important to us and is what we use to decide what to prioritise.
  • If there's an issue but you're not assigned, add Fixes #<n> anyway so they're linked, then engage on the issue itself by confirming the repro or describing the approach you'd take. Assignment is a maintainer call based on capacity; comments that only ask to be assigned don't factor in. If you are assigned, this PR reopens automatically.

You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned, and realistically most auto-closed PRs stay closed. There's no need to open a new PR either way.

CONTRIBUTING.md has the full reasoning, but in short:

  • We're a small team with very little capacity to review community PRs right now.
  • Many recent PRs are AI-generated with little human review, and reviewing one carefully still costs a maintainer as much time as it ever did. A well-described issue is usually more useful to us than the code.

Maintainers: reopen, remove missing-issue-link, or add bypass-issue-check to override.

@github-actions github-actions Bot closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing-issue-link Auto-closed: PR needs a linked issue assigned to its author (see CONTRIBUTING.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant